{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<style>div.container { width: 100% }</style>\n",
    "<img style=\"float:left;  vertical-align:text-bottom;\" height=\"65\" width=\"172\" src=\"../assets/PyViz_logo_wm_line.png\" />\n",
    "<div style=\"float:right; vertical-align:text-bottom;\"><h2>Tutorial 0. Setup</h2></div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This first step to the tutorial will make sure your system is set up to do all the remaining sections, with all software installed and all data downloaded as needed.  The [index](index.ipynb) covered background you might want before you start."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Getting set up\n",
    "\n",
    "Please consult [pyviz.org](http://pyviz.org/installation.html) for the full instructions on installing the software used in these tutorials. Here is the condensed version of those instructions, assuming you have already downloaded and installed [Anaconda](https://www.anaconda.com/download) or [Miniconda](https://conda.io/miniconda.html):"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```\n",
    "conda create -n pyviz-tutorial python=3.6\n",
    "conda activate pyviz-tutorial\n",
    "conda install -c pyviz/label/dev pyviz\n",
    "pyviz examples\n",
    "cd pyviz-examples\n",
    "jupyter notebook\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "See the full instructions at [pyviz.org](http://pyviz.org/installation.html) if you don't yet have conda, or if you have an old version of conda. \n",
    "\n",
    "Once everything is installed, the following cell should print '1.11.0a4' or later:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import holoviews as hv\n",
    "hv.__version__"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And you should see the HoloViews, Bokeh, and Matplotlib logos after running the following cell:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "hv.extension('bokeh', 'matplotlib')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The next cell tests the other key imports needed for this tutorial, and if it completes without errors your environment should be ready to go:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas\n",
    "import datashader\n",
    "import dask\n",
    "import geoviews\n",
    "import bokeh"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Downloading sample data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Lastly, let's make sure the datasets needed are available.  First, check that the large taxi dataset was downloaded correctly during installation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "if not os.path.isfile('../data/nyc_taxi_wide.parq'):\n",
    "    print('Taxi dataset not found; please run \"pyviz --download-sample-data ../data\".')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Finally, some examples in the tutorial rely on bokeh sample data, which you can get by running the command below:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "if not os.path.isfile(os.path.join(os.path.expanduser('~'),'.bokeh','data','routes.csv')):\n",
    "    bokeh.sampledata.download()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If you don't see any warning or error messages above, you should be good to go!  You can start with either [01 Workflow Introduction](01_Workflow_Introduction.ipynb) or [A2 Dashboard Workflow](A2_Dashboard_Workflow.ipynb).\n"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
